<!doctype html>
<html>

<head>
	<meta charset="utf-8">
	<title>无标题文档</title>
	<link href="/static/css/default.css" rel="stylesheet" type="text/css">
	<link href="/static/css/style/green.css" rel="stylesheet" type="text/css" id='link'>
	<link href="/static/js/datepicker/css/bootstrap-datepicker.css" rel="stylesheet">
</head>

<body style="padding:15px 8px 0px 8px;">



	<div class="classify">{$parenttitle}</div>


	<!--toolbar end-->

	<!--tablebox start-->
	<div class="tablebox" id="main">
		<!-- <ul class="toolbar">
			

		</ul> -->


		<!--toolbar start-->
		<ul class="toolbar">

			
			<li><a href="#" class="selected" id="clearkefu">取消客服</a></li>
		</ul>
		<br />
		<hr />
		<table>

			<thead>
				<th class="num"></th>

				<th>手机号</th>
				<th>微信头像</th>
				<th>微信昵称</th>
				<th>注册时间</th>
				<th>操作</th>

			</thead>

			<tbody ref="table">


				<tr v-for="uitem in arrayData">
					<td><input type="checkbox" class="selBtn" :data-id="uitem.id"></td>

					<td>{{uitem.phone}}</td>
					<td><img :src="uitem.headimgurl" width="50px;"></td>
					<td>{{uitem.nickname}}</td>
					<td>
						{{uitem.createtime}}
					</td>
					<td>
						<div class="am-btn-toolbar">
							<div class="am-btn-group am-btn-group-xs">
								<a v-on:click="vdel(uitem)">删除</a>
							</div>
						</div>
					</td>

				</tr>
				</tr>



			</tbody>

		</table>

		<div class="pagination">


			<vue-nav :cur="cur" :all="all" :allcount="allcount" :callback="callback"></vue-nav>




		</div>
	</div>
	<!--tablebox end-->

	<!--pagination start-->


	<!--pagination end-->

</body>
<script type="text/javascript" src="/static/js/jquery.js"></script>
<script type="text/javascript" src="/static/js/common.js"></script>

<script src="/static/js/layer/layer.js"></script>

<script type="text/javascript" src="/static/js/vue2.js"></script>
<script type="text/javascript" src="/static/js/vue-nav.js"></script>
<script src="/static/My97DatePicker/WdatePicker.js"></script>
<script>
	var vm = new Vue({
		el: "#main",
		data: {
			cur: 1,
			all: 0,
			size: 10,
			allcount: 0,
			arrayData: [],
			types: [
			
				{ id: 1, typename: "家长" },
				{ id: 2, typename: "老师" },
			]

		},
		components: {
			'vue-nav': Vnav
		},
		methods: {
			getdata: function (_keycontent) {  //查询数据

				var self = this;
	
				var iskefu ="1"
			
				$.post("/Super/User/getalluser", { page: self.cur, size: self.size,iskefu:iskefu }, function (_result) {
					self.arrayData = _result.list;
					self.all = _result.count;
					self.allcount = _result.allcount
				});

			},
			callback: function (data) {

				var self = this;
				this.cur = data;
				var iskefu ="1"
				$.post("/Super/User/getalluser", { page: self.cur, size: self.size,iskefu:iskefu }, function (_result) {

					self.arrayData = _result.list;
					self.all = _result.count;
					self.allcount = _result.allcount
				});
			},
			vdel: function (uitem) {
				var self = this;
				parent.layer.confirm('确定要删除吗?', {
					btn: ['是', '否'] //按钮
				}, function () {
					parent.layer.closeAll('dialog');
					$.post("/Super/User/userdel", { "id": uitem.id }, function (data) {
						if (data.status == 200) {
							layer.msg(data.message);
							self.getdata("");
						} else {
							layer.msg(data.message);
						}
					});
				}, function () {

				});

			}
		},
		created: function () {  //初始化事件里边去调用查询方法
			this.getdata("");
		}
	});

	$(function () {
		
		$("#clearkefu").click(function () {
			var idarr = [];
			var checkdom = vm.$refs.table.getElementsByClassName("selBtn");
			console.log(checkdom);
			for (var i = 0; i < checkdom.length; i++) {
				if (checkdom[i].checked) {
					idarr.push(checkdom[i].dataset.id);
				}
			}
			if (idarr.length > 0) {
				parent.layer.confirm('确定要取消客服吗?', {
					btn: ['是', '否'] //按钮
				}, function () {
					parent.layer.closeAll('dialog');
					$.post("/super/Mechanism/setkefu", { "idarr": idarr.join(','), state: 0 }, function (data) {
						if (data.status == 200) {
							layer.msg(data.message);
							vm.getdata("");
						} else {
							layer.msg(data.message);
						}
					});
				}, function () {

				});
			} else {
				layer.msg("请选择");
			}


		});

		$("#search").click(function () {

			vm.getdata("");
		});
		$("#clear").click(function () {
			$("#mechanismname").val("");
			$("#stime").val("");
			$("#etime").val("");
			$("#typeid").val("0");

		});

	});

</script>

</html>